﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Charge.aspx.cs" Inherits="JKF.Web.SMS.Sms_Account.Charge" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
        <%=RegScript("~/js/jquery.1.5.js")%>
        <%=RegScript("~/js/Common.js")%>
        <%=RegScript("~/js/jquery.json.js")%>
        <%=RegScript("~/js/jquery.nhis.js")%>
        <%=RegScript("~/js/jquery.rchis.js")%>
        <%=RegScript("~/js/jquery.validate.js")%>
        <%=RegScript("~/js/DatePicker/WdatePicker.js")%>
        <%=RegStyle("~/js/suggest/jquery.suggest.css")%>
        <%=RegScript("~/js/jquery-ui-custom.min.js")%>
        <script src="../../js/Uppop/tipswindown2.js"  type="text/javascript"></script>
        
     <link href="../../App_Themes/Theme2/Include.css"   rel="stylesheet" type="text/css" />

    <script type="text/javascript" language="javascript">
        $(function () {
            $("#BtnSave").click(function () {
                saveChargeLog();
            })
        });     
    </script>

    <script type="text/javascript">
        var arrLinkBtn = new Array();
        arrLinkBtn.push(new Array('clearForm()', '继续添加')); //调用函数的参数要用双引号
        arrLinkBtn.push(new Array('parent.tipsWindown.close()', '返回列表')); //调用函数的参数要用双引号


        var AppPath = "<%=AppPath %>";
        var handler = AppPath + '/do/SMS/Sms_Charge_Log.do';
        var SHOP_CODE = '<%=P("shopCode")%>';
        var SHOP_NAME = '<%=P("shopName")%>';

        var dateCreate = '<%=DateTime.Now.ToString("yyyy-MM-dd") %>'; //如果是添加则取当前日期 如果是修改则是数据创建时间
        var ntEmpt = /^[^ ]+$/;
        var dtReg = /^\d{4}(\/|-)([1][0-2]|[1-9]|0[1-9])(\/|-)([1-2][0-9]|3[0-1]|[1-9]|0[1-9])( (0?[0-9]|1[0-9]|2[0-4])(:([0-5][0-9])){1,2})?$/;

        $(function () {
            $("#SHOP_CODE").val(SHOP_CODE);
            $("#SHOP_NAME").val(SHOP_NAME);
            check();

            $('#btnclose').click(function () {
                parent.tipsWindown.close();
            });
        });

        function check() {
            alxVr.push({
                id: 'CHARGE_COUNT',
                rule: function (jd) {
                    if (!ntEmpt.test(jd.val())) {
                        this.msg = "请填写短信条数"; return false;
                    } 

                    if (!ntEmpt.test(jd.val())) {
                        this.msg = "请填写短信条数"; return false;
                    }
                    var v = jd.val();
                    if (v.length > 5) {
                        return false;
                    }
                    var reg = /^\d+$/;
                    return reg.test(jd.val());
                },
                msg: '短信条数应为整数',
                isReq: false
            });         

            $.validateBind();
        }

        function saveChargeLog() {
            if (!$.validateAll()) {
                if ($(".alxv-failed").size() > 0) {
                    $(document).scrollTop($(".alxv-failed").eq(0).scrollTop());
                }
                return;
            };

            if ($.FxNull(SHOP_CODE, "")=="") {//主键
                alert("参数错误");
                return;
            }

            $.post(handler, { ActionName: "SaveChargeLog", SHOP_CODE: $("#SHOP_CODE").val(), CHARGE_COUNT: $("#CHARGE_COUNT").val(), MEMO: $("#MEMO").val() }, function (rslt) {
                if (rslt.MessageCode == "Ok") {//保存成功
                    updateView(); //添加或修改数据成功后更新列表页面
                    $.popResultTip('操作成功', arrLinkBtn)
                    return;
                }
                alert(rslt.Message);
            }, "json");

        }

        function updateView() {
            window.parent.popRetuInfo($("#CHARGE_COUNT").val(), SHOP_CODE)
        }

        //清空表单
        function clearForm() {
            $("#CHARGE_COUNT").val("");
            $("#MEMO").val("");
            $('#resultTipDiv').dialog('close');         
        } 
    </script>
</head>
<body id="modulebody">
    <div class="pop_logging_body" style="padding:22px 70px; margin-top:0px; margin-bottom:26px; margin-right:35px; margin-left:35px ">
          <table width="100%" border="0" cellspacing="0" cellpadding="0" class="common_table_noborde">
              <tr>
                 <td width="15%" align="right">店铺编码</td>
                 <td width="35%">
                     <input id="SHOP_CODE" type="text" disabled="disabled" /></td>
                 <td width="5%">&nbsp;</td>
                 <td width="15%" align="right">店铺名称</td>
                 <td>
                     <input id="SHOP_NAME" type="text" disabled="disabled" /></td>
              </tr>
               <tr>
                 <td><span class="fred">*</span>短信条数</td>
                 <td>                 
                     <input id="CHARGE_COUNT" type="text" /></td>
                 <td width="5%">&nbsp;</td>
                 <td>备注</td>
                 <td>                 
                     <input id="MEMO" type="text" /></td>                
              </tr>              
          </table>
      </div>
     <div class="pop_btn">
         <input id="BtnSave" type="button" class="common_btn_save mr30 mb25" value="" />
	     <input id="btnclose" type="button" class="common_btn_remove mb25" value=" "  />
     </div>
</body>
</html>